package com.monitoring.infrastructure.config;

import com.monitoring.domain.repository.DeviceRepository;
import com.monitoring.domain.repository.EnvironmentalDataRepository;
import com.monitoring.domain.repository.SensorRepository;
import com.monitoring.domain.service.DeviceService;
import com.monitoring.domain.service.EnvironmentalMonitoringService;
import com.monitoring.domain.service.SensorService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ApplicationConfig {

    @Bean
    public SensorService sensorService(SensorRepository sensorRepository) {
        return new SensorService(sensorRepository);
    }

    @Bean
    public DeviceService deviceService(DeviceRepository deviceRepository) {
        return new DeviceService(deviceRepository);
    }

    @Bean
    public EnvironmentalMonitoringService environmentalMonitoringService(
            EnvironmentalDataRepository environmentalDataRepository,
            SensorRepository sensorRepository,
            DeviceRepository deviceRepository) {
        return new EnvironmentalMonitoringService(environmentalDataRepository, sensorRepository, deviceRepository);
    }
}